class Decorator(object):
    """
        类装饰器
            类装饰器的本质就是利用对象的可调用方法__call__.
            在__call__方法中对构造对象时所传入的方法或者函数进行增强
    """
    def __init__(self,func):
        self.func = func

    def __call__(self, *args,**kwargs):
        """
        Traceback (most recent call last):
          File "E:/WN15/Python/Code/Day13/demo04/Demo01.py", line 10, in <module>
            d(5,6)
        TypeError: 'Decorator' object is not callable
        正常情况下一个class的实例不是可调用对象.如果我们希望该实例可以被调用.则
        必须提供__call__方法.
        :param x:
        :param y:
        :return:
        """
        print("前置增强")
        result = self.func(*args,**kwargs)
        print("后置增强")
        return result


@Decorator  # 等同于Decorator()()
def method(x,y,z,w,q):
    print(x,y,z,w,q)
    return 110


print(method(1,2,3,4,5))

